import time
from utils.selenium_framework import FindElementType, BasePage
   

class MainPage(BasePage):
    def __init__(self):
        super().__init__(driver_path="D:\\Auto-Test\\tool\\chromedriver.exe")
        self.open('https://www.taobao.com/')
        self.login_photo = "13420685558"

    def login(self):
        # 请注册
        self.click_element(FindElementType.CLASS,"h")
        # 短信登录
        self.click_element(FindElementType.CLASS,"sms-login-tab-item")
        
        # 手机号
        self.input_data(FindElementType.ID,"fm-sms-login-id",self.login_photo)
        
        # 获取验证码
        self.click_element(FindElementType.CLASS,"send-btn-link")
        data = input("请查看手机短信获取验证码")
        data = data.strip().replace(" ","")
        
        # 验证码
        self.input_data(FindElementType.ID,"fm-smscode",data)
        
        # 登录
        self.click_element(FindElementType.CLASS,"fm-button")
        
    def run(self):
        self.login()
